package com.itheima;

import com.itheima.dao.BookDao;
import com.itheima.service.impl.BookServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppForLifeCycle {
    public static void main(String[] args) {

        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
//        context.registerShutdownHook();//注册关闭钩子
        BookDao  bookDao = (BookDao) context.getBean("bookDao");
        bookDao.save();
        context.close();
    }
}
